package com.bwie.controller;

import com.bwie.pojo.Brand;
import com.bwie.pojo.Connect;
import com.bwie.pojo.Template;
import com.bwie.service.BrandService;
import com.bwie.service.ConnectService;
import com.bwie.service.TemplateService;
import com.bwie.unit.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping("user")
@RestController
public class TemplateController {
    @Resource
    private TemplateService templateService;
    @Resource
    private BrandService brandService;
    @Resource
    private ConnectService connectService;

    @PostMapping("TemplateList")
    public R TemplateList(){
        List<Template> list = templateService.list();
        return R.OK(list);
    }

    @PostMapping("brandType")
    public R brandType(){
        List<Brand> list = brandService.list();
        return R.OK(list);
    }


    @PostMapping("connectType")
    public R connectType(){
        List<Connect> list = connectService.list();
        return R.OK(list);
    }


    @PostMapping("addTemplate")
    public R addTemplate(@RequestBody Template template){
        templateService.save(template);
        return R.OK();
    }

}
